﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NCT.Framework;
using VISS.API.Users;

namespace VISS.Web.Frontend.Modules.General {
    public partial class HeaderBarControl : System.Web.UI.UserControl {
        public string PageOf { get; set; }
        protected string FullName { get; set; }
        protected string UserKey { get; set; }
        protected bool HasNewMessages { get; set; }
        protected int NumberOfNewMessages { get; set; }

        protected void Page_Load(object sender, EventArgs e) {
            UserContext userContext = LoginFactory.GetCurrentUser();
            if (userContext != null)
            {
                UserKey = userContext.UserKey;

                FullName = userContext.FullName;

                NumberOfNewMessages = StructureMapFactory.GetInstance<IUserMessage>().GetUnReadMessagesCount(userContext.UserKey);
                if (NumberOfNewMessages > 0)
                {
                    HasNewMessages = true;
                }
                else
                {
                    HasNewMessages = false;
                }
            }
        }
    }
}